<template>
	<view>
		<view class="pageinfo">
			<video style="width: 100%;" v-if="video" id="myVideo" :src="video" autoplay @error="videoErrorCallback" controls></video>
			<jyf-parser :html="info" :selectable="true"></jyf-parser>
		</view>
		<!--加载遮罩-->
		<loadingpage v-if="globelloading"></loadingpage>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				globelloading: true,
				video: '',
				info: ''
			}
		},
		onLoad(option) {
			this.getinfo(option.key);
		},
		watch: {
			info() {
				this.globelloading = false;
			}
		},
		methods: {

			getinfo(keys) {
				this.$HttRequest({
					url: '/richText?key=' + keys,
					param: ''
				}).then((res) => {
					if (res.status === 10000) {
						console.log(res);
						uni.setNavigationBarTitle({
							title: res.data.title,
						});
						this.info = res.data.body;
						this.video = res.data.video;
					} else {
						this.$ShowMsg(res.message)
					}
				}).catch((error) => {
					//异常错误
					this.$ShowMsg('statusCode：' + error.errMsg);
				});
			},
			videoErrorCallback(e) {
				console.log(e);
			}
		}
	}
</script>

<style>
	.pageinfo {
		flex: 1;
		padding: 30rpx;
	}
</style>
